export const manageMap = [{
  name: 'agent',
  children: [
    {
      name: 'agent_info'
    }
  ]
}, {
  name: 'custom',
  children: [
    {
      name: 'custom_info'
    }
  ]
}, {
  name: 'user_manage',
  children: [
    {
      name: 'app_user_manage'
    },
    {
      name: 'app_suggest_feedback'
    },
    {
      name: 'login_user_manage'
    },
    {
      name: 'login_rule_manage'
    },
    {
      name: 'login_log'
    },
    {
      name: 'login_msg'
    }
  ]
}, {
  name: 'record_query',
  children: [
    {
      name: 'charge_history'
    },
    {
      name: 'upload_history'
    },
    {
      name: 'deal_history'
    },
    {
      name: 'error_history'
    }
  ]
}, {
  name: 'stats_statistic',
  children: [
    {
      name: 'stats_income'
    },
    {
      name: 'stats_agent_income'
    },
    {
      name: 'stats_bus_income'
    },
    {
      name: 'stats_charge_type'
    },
    {
      name: 'stats_month_type'
    },
    {
      name: 'stats_no_card'
    }
  ]
}]

export const agentMap = [{
  name: 'agent',
  title: 'agent_manage', // 运营商管理
  children: [
    {
      name: 'user_edit'
    },
    {
      name: 'charge_station',
      title: 'charge_manage'
    },
    {
      name: 'login_user_manage'
    },
    {
      name: 'login_rule_manage'
    },
    {
      name: 'login_log'
    },
    {
      name: 'login_msg'
    }
  ]
}, {
  name: 'custom',
  children: [
    {
      name: 'custom_info'
    }
  ]
}, {
  name: 'stats_statistic',
  title: 'data_stats_statistic',
  children: [
    {
      name: 'stats_income'
    },
    {
      name: 'stats_agent_income'
    },
    {
      name: 'stats_bus_income'
    },
    {
      name: 'stats_charge_type'
    },
    {
      name: 'stats_month_type'
    },
    {
      name: 'stats_no_card'
    }
  ]
}]

export const stationMap = [{
  name: 'station',
  title: 'station_administer',
  children: [
    {
      name: 'station_manage'
    },
    {
      name: 'pile_query',
      title: 'pile_manage'
    },
    {
      name: 'login_user_manage'
    },
    {
      name: 'login_rule_manage'
    },
    {
      name: 'login_log'
    },
    {
      name: 'login_msg'
    },
    {
      name: 'vin_bus_info'
    }
  ]
}, {
  name: 'custom',
  title: 'custom_manage',
  children: [
    {
      name: 'custom_info',
      title: 'custom_manage'
    }
  ]
}, {
  name: 'record_query',
  children: [
    {
      name: 'charge_history'
    },
    {
      name: 'upload_history',
      title: 'pile_log_info'
    },
    {
      name: 'deal_history'
    },
    {
      name: 'error_history'
    },
    {
      name: 'query_recharge_log'
    }
  ]
}, {
  name: 'stats_statistic',
  title: 'data_stats_statistic',
  children: [
    {
      name: 'stats_income',
      title: 'phone_pile_income'
    },
    {
      name: 'stats_agent_income',
      title: 'stats_custom_income'
    },
    {
      name: 'stats_bus_income'
    },
    {
      name: 'stats_charge_type'
    },
    {
      name: 'stats_month_type'
    },
    {
      name: 'stats_no_card'
    },
    {
      name: 'stats_24h_type'
    },
    {
      name: 'stats_pile'
    },
    {
      name: 'phone_user_income'
    },
    {
      name: 'stats_iccard'
    },
    {
      name: 'stats_kc'
    }
  ]
}]

const flat = function (menu, data) {
  menu.forEach(m => {
    data.push(m)
    if (m.children && m.children.length) {
      flat(m.children, data)
    }
  })
}

const flatManageMap = []
const flatAgentMap = []
const flatStationMap = []

flat(manageMap, flatManageMap)
flat(agentMap, flatAgentMap)
flat(stationMap, flatStationMap)

export { flatManageMap, flatAgentMap, flatStationMap }
